package com.mproject.activity;

import com.mproject.network.NetworkManager;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.util.Log;

public class C2DMRegistrationReceiver extends BroadcastReceiver {
	
	@Override
	public void onReceive(Context context, Intent intent) {
		String action = intent.getAction();
		Log.w("C2DM", "Registration Receiver called");
		if ("com.google.android.c2dm.intent.REGISTRATION".equals(action)) {
			Log.w("C2DM", "Received registration ID");
			final String registrationId = intent
					.getStringExtra("registration_id");
			//put regid to share preferences
			SharedPreferences.Editor editor=SplashScreen.mypref.edit();
			editor.putString("regid",registrationId);
			editor.commit();
			String error = intent.getStringExtra("error");

			Log.d("C2DM", "dmControl: registrationId = " + registrationId
					+ ", error = " + error);
		/*	String deviceId = Secure.getString(context.getContentResolver(),
					Secure.ANDROID_ID);*/
			//createNotification(context, registrationId);
			
		}
	}
	
}



